#ifndef RAYCASTER_H
#define RAYCASTER_H

#include "scene.h"
#include "ray.h"
#include "cgmaterial.h"
#include "cgcolorbuffer.h"

class RayCaster
{
public:
    RayCaster();
    const CgColorBuffer* render(Scene *scene, int width, int height);
private:
    bool get_ray_collision(const Scene *scene, const Ray &ray, double &t, Vector &normal, CgMaterial &material) const;
    CgColor get_point_color(const Scene *scene, const Point &p, const Vector &normal, const CgMaterial &material) const;
    void applySceneTransformations(Scene *scene) const;
    CgColor PhongShade(const ILightSource *light, const Point &p, const Vector &normal, const CgMaterial &material) const;
};

#endif // RAYCASTER_H
